package com.wzy.java;

import com.sun.xml.internal.ws.util.StringUtils;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;

public class test6 {
    public static void main(String[] args) {
        List<stuVO> list = new ArrayList<>();

        stuVO w = getTest5Info(1, "", 1);
        stuVO e = getTest5Info(2, "", 21);
        stuVO r = getTest5Info(3, "", 21);
        stuVO t = getTest5Info(4, "tt", 1);
        stuVO y = getTest5Info(5, "tt", 2);

        list.add(w);
        list.add(e);
        list.add(r);
        list.add(t);
        list.add(y);
//        list.removeIf(t5 -> t5.getName().equals("r"));
//        List<stuVO> collect = list.stream().filter(item -> (!"r".equals(item.getName()))).collect(Collectors.toList());
//        List<stuVO> collect = list.stream().filter(item -> (item.getAge()!=1)).collect(Collectors.toList());

//        list.removeIf(next -> next.getId() == next.getAge());

        for (stuVO stu : list) {
            if (!"".equals(stu.getName())) {
                int age = stu.getAge();
                list.removeIf(item -> (item.getId() == age));
            }
        }


        // print
        for (stuVO s : list) {
            System.out.println(s.toString());
        }
    }

    private static stuVO getTest5Info(int id, String name, int age) {
        stuVO t = new stuVO();
        t.setId(id);
        t.setName(name);
        t.setAge(age);
        return t;
    }
}
